<!--
*Author：jxx
 *Contact：283591387@qq.com
 *代码由框架生成,任何更改都可能导致被代码生成器覆盖
 *业务请在@/extension/service/products/Product.jsx此处编写
 -->
<template>
    <view-grid ref="grid"
               :columns="columns"
               :detail="detail"
               :editFormFields="editFormFields"
               :editFormOptions="editFormOptions"
               :searchFormFields="searchFormFields"
               :searchFormOptions="searchFormOptions"
               :table="table"
               :extend="extend">
    </view-grid>
</template>
<script>
    import extend from "@/extension/service/products/Product.jsx";
    import { ref, defineComponent } from "vue";
    export default defineComponent({
        setup() {
            const table = ref({
                key: 'ProductId',
                footer: "Foots",
                cnName: '产品管理',
                name: 'products/Product',
                url: "base-read/api/Product/",
                sortName: "Product"
            });
            const editFormFields = ref({"ProductName":"","SupplierId":"","InsideId":"","UnitId":"","SortId":"","EarlyWarningFront":"","EarlyWarningBelow":"","Specification":"","Price":"","Weight":"","DefaultRepository":"","DefaultLibraryLocation":"","DefaultSupplier":"","DefaultCustomer":"","Describe":"","StartStock":""});
            const editFormOptions = ref([[{"title":"产品名称","field":"ProductName"},
                               {"title":"厂商编码","field":"SupplierId"},
                               {"title":"内部编码","field":"InsideId"}],
                              [{"dataKey":"unit","data":[],"title":"单位","field":"UnitId","type":"select"},
                               {"dataKey":"CategoryCascader","data":[],"title":"类别","field":"SortId","type":"select"}],
                              [{"title":"预警（下）","field":"EarlyWarningFront"},
                               {"title":"预警（上）","field":"EarlyWarningBelow"}],
                              [{"title":"规格","field":"Specification"},
                               {"title":"价格","field":"Price","type":"decimal"},
                               {"title":"重量","field":"Weight"}],
                              [{"dataKey":"warehouse","data":[],"title":"默认仓库","field":"DefaultRepository","type":"select"},
                               {"dataKey":"Location","data":[],"title":"默认库位","field":"DefaultLibraryLocation","type":"select"}],
                              [{"title":"默认供应商","field":"DefaultSupplier"},
                               {"title":"默认客户","field":"DefaultCustomer"}],
                              [{"title":"描述","field":"Describe"},
                               {"title":"期初库存","required":true,"field":"StartStock","type":"number"}]]);
            const searchFormFields = ref({"ProductName":"","DefaultRepository":""});
            const searchFormOptions = ref([[{"title":"产品名称","field":"ProductName"},{"dataKey":"warehouse","data":[],"title":"默认仓库","field":"DefaultRepository"}]]);
            const columns = ref([{field:'ProductId',title:'产品编号',type:'string',width:220,hidden:true,readonly:true,require:true,align:'left'},
                       {field:'ProductName',title:'产品名称',type:'string',width:220,align:'left',sort:true},
                       {field:'SupplierId',title:'厂商编码',type:'string',width:220,align:'left'},
                       {field:'InsideId',title:'内部编码',type:'string',width:220,align:'left'},
                       {field:'UnitId',title:'单位',type:'string',bind:{ key:'unit',data:[]},width:220,align:'left'},
                       {field:'SortId',title:'类别',type:'string',bind:{ key:'CategoryCascader',data:[]},width:220,align:'left'},
                       {field:'EarlyWarningFront',title:'预警（下）',type:'string',width:220,align:'left'},
                       {field:'EarlyWarningBelow',title:'预警（上）',type:'string',width:220,align:'left'},
                       {field:'Specification',title:'规格',type:'string',width:220,align:'left'},
                       {field:'Price',title:'价格',type:'decimal',width:110,align:'left'},
                       {field:'Weight',title:'重量',type:'string',width:220,align:'left'},
                       {field:'DefaultRepository',title:'默认仓库',type:'string',bind:{ key:'warehouse',data:[]},width:220,align:'left'},
                       {field:'DefaultLibraryLocation',title:'默认库位',type:'string',bind:{ key:'Location',data:[]},width:220,align:'left'},
                       {field:'DefaultSupplier',title:'默认供应商',type:'string',width:220,align:'left'},
                       {field:'DefaultCustomer',title:'默认客户',type:'string',width:220,align:'left'},
                       {field:'Describe',title:'描述',type:'string',width:220,align:'left'},
                       {field:'StartStock',title:'期初库存',type:'int',width:110,require:true,align:'left'},
                       {field:'StockIn',title:'入库数量',type:'int',width:110,align:'left'},
                       {field:'StockOut',title:'出库数量',type:'int',width:110,align:'left'},
                       {field:'SumStock',title:'总库存',type:'int',width:110,align:'left'},
                       {field:'IsDeleted',title:'IsDeleted',type:'sbyte',width:110,hidden:true,align:'left'}]);
            const detail = ref({
                cnName: "#detailCnName",
                table: "#detailTable",
                columns: [],
                sortName: "",
                key: ""
            });
            return {
                table,
                extend,
                editFormFields,
                editFormOptions,
                searchFormFields,
                searchFormOptions,
                columns,
                detail,
            };
        },
    });
</script>
